package org.anno.chunkdb.backend.query;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;

/**
 * A numeric column for query results.
 */
public interface NumberResultColumn<R> extends ResultColumn<R> {

  default Type type() {
    return Type.STRING;
  }

  double getDouble(R row);

  default void writeValue(R r, OutputStream out) throws IOException {
    out.write(Double.toString(getDouble(r)).getBytes(StandardCharsets.UTF_8));
  }
}
